home *** CD-ROM | disk | FTP | other *** search
/ How Many Bugs in a Box / How Many Bugs in a Box.cdr / bugs / act8 / 00364_buggyhead.ls < prev    next >
Encoding:
Text File  |  1995-03-28  |  1.8 KB  |  63 lines

  1. property bugx, bugy, bodychan, bodylist, lipchan, bugbody, buglips, bugsayit, bugsound, bugtempo, hypno, bugtext, mouseout
  2.  
  3. on birth me, bchan, lchan, commandset
  4.   set bugx to the locH of sprite bchan
  5.   set bugy to the locV of sprite bchan
  6.   set lipchan to lchan
  7.   set bodychan to bchan
  8.   puppetSprite(lchan, 1)
  9.   puppetSprite(bchan, 1)
  10.   set bugbody to the castNum of sprite bchan
  11.   set buglips to getaProp(commandset, #lips)
  12.   set bugsound to getaProp(commandset, #sound)
  13.   set bugtext to getaProp(commandset, #text)
  14.   set bodylist to value(string(getaProp(commandset, #body)))
  15.   repeat with xxx in bodylist
  16.     setAt(xxx, 2, the number of cast getAt(xxx, 2))
  17.   end repeat
  18.   set mouseout to 1
  19.   put bodylist
  20.   return me
  21. end
  22.  
  23. on sayit me
  24.   if hypno = 0 then
  25.     grabbuggy(me)
  26.   end if
  27.   set soundtime to the size of cast bugsound / 183.0
  28.   set soundscale to the number of chars in bugtext / soundtime
  29.   puppetSound(bugsound)
  30.   updateStage()
  31.   set stime to the timer
  32.   set numchar to the number of chars in bugtext
  33.   repeat while the timer < (soundtime + stime + 20)
  34.     set ptime to the timer - stime
  35.     set presentchar to 1 + (soundscale * ptime)
  36.     if presentchar <= numchar then
  37.       set the castNum of sprite lipchan to getaProp(buglips, char presentchar of bugtext)
  38.     else
  39.       set the castNum of sprite lipchan to getaProp(buglips, " ")
  40.     end if
  41.     updateStage()
  42.     if the mouseDown and (mouseout = 1) then
  43.       exit repeat
  44.     end if
  45.   end repeat
  46.   set the castNum of sprite lipchan to getaProp(buglips, " ")
  47. end
  48.  
  49. on releasebuggy me
  50.   puppetSprite(lipchan, 0)
  51.   puppetSprite(bodychan, 0)
  52.   set hypno to 0
  53. end
  54.  
  55. on grabbuggy me
  56.   puppetSprite(lipchan, 1)
  57.   puppetSprite(bodychan, 1)
  58.   set the castNum of sprite bodychan to bugbody
  59.   sactivate(26, sinfo(25))
  60.   set the castNum of sprite lipchan to getAt(buglips, 1)
  61.   set hypno to 1
  62. end
  63.